package com.naiterui.ehp.bs.doctor.vo.medicine;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.naiterui.ehp.bp.utils.lang.ConfigUtil;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "MedicineDateAndMethodVO", description = "服用时间和方式")
public class MedicineDateAndMethodVO implements Serializable {

    /**
     * 字段或域定义：<code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "服用时间:饭前、饭后等")
    private String takeDate;

    @ApiModelProperty(value = "服用方式:注射、口服等")
    private String takeMethod;

    public String getTakeDate() {
        return this.takeDate;
    }

    public void setTakeDate(String takeDate) {
        this.takeDate = takeDate;
    }

    public String getTakeMethod() {
        return this.takeMethod;
    }

    public void setTakeMethod(String takeMethod) {
        this.takeMethod = takeMethod;
    }

    public static List<MedicineDateAndMethodVO> toVOList() {
        List<MedicineDateAndMethodVO> list = new ArrayList<>();
        String dateAndMethodList = ConfigUtil.getString("init.medicine.dateAndMethodList");
        dateAndMethodList = " " + dateAndMethodList;
        String[] strArray = dateAndMethodList.split(",");
        for (String aStrArray : strArray) {
            MedicineDateAndMethodVO vo = new MedicineDateAndMethodVO();
            String[] str = aStrArray.split("-");
            vo.setTakeDate(str[0]);
            vo.setTakeMethod(str[1]);
            list.add(vo);
        }
        return list;
    }
}
